Who (Subject)
1) When providing extra information about the subject in the sentence.
2) When you are asking about the subject.
例子:Ali is my friend who is a teach.
Who rang the doorbell?
Whom (Object)
1) When providing extra information about the object in the sentence.
2) When you are asking about the object.
例子:Ali is the man whom I told you about.
To whom did you give the notebook?